//
//  UIView+HUD.m
//  YSSmartHome
//
//  Created by yanghao on 2017/8/14.
//  Copyright © 2017年 YangHao. All rights reserved.
//

#import "UIView+HUD.h"

const NSTimeInterval HUBHideDelay = 1.0;

@implementation UIView (HUD)

- (void)yh_showMsgHUD:(NSString*)msg {
    MBProgressHUD* hub = [MBProgressHUD showHUDAddedTo:self animated:true];
    hub.mode = MBProgressHUDModeText;
    hub.label.text = msg;
    [hub hideAnimated:true afterDelay:HUBHideDelay];
}

- (void)yh_showLoadingHUD {
    [MBProgressHUD showHUDAddedTo:self animated:true];
}

- (void)yh_showLoadingHUD:(NSString*)msg {
    MBProgressHUD* hub = [MBProgressHUD showHUDAddedTo:self animated:true];
    hub.label.text = msg;
}
- (void)yh_hideAllHUD {
    [MBProgressHUD hideAllHUDsForView:self animated:true];
}
@end
